package org.lewis.common.domain;

import java.util.Date;

import org.apache.commons.lang.StringUtils;


public class User extends BaseEntity{
	
	public static final String DEFAULT_FACE="photo.jpg";
	
	private static final long serialVersionUID = 1L;

	private String email;
	
	private String name;
	
	private String password;
	
	private Date createTime;
	
	/**0:未激活 1:使用中 2:禁用**/
	private Integer status;
	
	private String photo;
	
	private String mydesc;
	
	private String tags;
	
	public User(){}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}
	
	
	public String getPhoto() {
		return photo;
	}

	public void setPhoto(String photo) {
		this.photo = photo;
	}


	public String getMydesc() {
		return mydesc;
	}

	public void setMydesc(String mydesc) {
		this.mydesc = mydesc;
	}

	public String getTags() {
		return tags;
	}

	public void setTags(String tags) {
		this.tags = tags;
	}

	public String getStatusStr(){
		if(this.status==0){
			return "未激活";
		}else if(this.status==1){
			return "使用中";
		}else if(this.status==2){
			return "已禁用";
		}
		return "";
		
	}
	
	public String getSmallPhoto(){
		if (StringUtils.isBlank(photo)) {
			return DEFAULT_FACE;
		}
		String smallfile=StringUtils.substringBeforeLast(photo, ".");
		smallfile=smallfile+"_small.jpg";
		return smallfile;
	}
	
	public String getMiniPhoto(){
		if (StringUtils.isBlank(photo)) {
			return DEFAULT_FACE;
		}
		String smallfile=StringUtils.substringBeforeLast(photo, ".");
		smallfile=smallfile+"_mini.jpg";
		return smallfile;
	}
	
	public String getMaxPhoto(){
		String photo = this.photo;
		if (StringUtils.isBlank(photo)) {
			photo = DEFAULT_FACE;
		}
		return photo;
		
	}
	

}
